#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @time     : 2020/7/3 16:12
# @Author   : BYF
# file      : test.py
# @version  :


# 导入库
# from allpairspy import AllPairs
# from selenium import webdriver
# import time
# import requests
# import pytest


# # 列出所有参数
parameters = [
    ["代金券", "折扣券"],
    # ["入住", "乐乎分期", "合同账单", "续租","续租短租","逾期管理费","杂费","会员卡"],
    ["入住", "合同账单"],
    ["APP", "PC"],
    ["服务费", "租金", "月付租金", "押金"],
    ["无门槛", "押付方式", "合同周期", "新会员首单"]
]

def download_room(driver, url):
    url = url
    driver.get(url=url)
    print("OK")

apartment_ids = [1, 2, 7, 8, 9, 10, 11, 15, 17, 18, 21, 27, 29, 33, 34, 37, 38, 43, 47, 49, 52, 59, 73, 81, 90, 94, 200,
                     268, 311, 325, 481, 604, 666, 761, 813, 835, 839, 841, 848, 853, 854, 856, 858, 861, 862, 866, 870, 880,
                     883, 884, 895, 896, 905, 906, 907, 910, 913, 914, 917, 919, 920, 926, 927, 931, 932, 28, 76, 80, 86,
                     112, 213, 871, 877, 899, 100, 120, 87, 117, 888, 889, 890, 891, 892, 893, 51, 109, 124, 141, 332, 78,
                     82, 88, 91, 93, 97, 98, 118, 131, 133, 134, 135, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
                     221, 222, 223, 224, 225, 226, 227, 228, 243, 245, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 282,
                     283, 284, 285, 337, 359, 366, 421, 440, 446, 447, 448, 483, 485, 486, 530, 545, 555, 556, 608, 631, 748,
                     807, 831, 847, 859, 874, 900, 902, 908, 909, 912, 928, 101, 102, 103, 126, 193, 211, 308, 387, 397, 540,
                     843, 846, 67, 68, 74, 79, 83, 85, 165, 207, 640, 922]

apartment_ids1 = [2]

# @pytest.mark.parametrize("apartment_id",apartment_ids)
# def test_check_income_expenditure_overview(apartment_id):
#     test_url = "https://api-test.lefull.cn/salestarget/api/v1/export/queryIncomeExpenditureOverviewBySearch"
#     pro_url = "https://api-v3.lefull.cn/salestarget/api/v1/export/queryIncomeExpenditureOverviewBySearch"
#     test_headers = {
#         "keys": "lisa_1a0cde30935b6b8315dd302501af8449",
#         "Content-Type": "application/x-www-form-urlencoded",
#     }
#
#     pro_headers = {
#         "keys": "lisa_2240adc6a84d8edd0c53335ffead484a",
#         "Content-Type": "application/x-www-form-urlencoded",
#     }
#     data = {
#         "currentPage": "1",
#         "itemsPerPage": 10000,
#         "payBeginDate": "2020-11-30",
#         "payEndDate": "2020-12-06",
#         "operateBeginDate": "",
#         "operateEndDate": "",
#         "startVerifyTime": "",
#         "endVerifyTime": "",
#         "apartmentIds": f"{apartment_id}",
#         "apartmentId": "",
#     }
#     print("\n")
#     print(f"正在核对门店ID {apartment_id} 的数据")
#
#     test_res = requests.post(url=test_url, data=data, headers=test_headers).json()
#     pro_res = requests.post(url=pro_url, data=data, headers=pro_headers).json()
#
#     assert test_res["code"] == pro_res["code"]  # 校验返回码
#     assert test_res["data"]["total"] == pro_res["data"]["total"]  # 校验总条数
#     assert test_res["data"]["total"] == pro_res["data"]["total"]  # 校验总条数
#     test_list = test_res["data"]["list"]
#     pro_list = test_res["data"]["list"]
#     for test in test_list:
#         for pro in pro_list:
#             if test["tableName"] == pro["tableName"] and test["tableUuidF"] == pro["tableUuidF"]:
#                 assert test["actualStatementId"] == pro["actualStatementId"]
#                 assert test["apartmentName"] == pro["apartmentName"]
#                 assert test["contractId"] == pro["contractId"]
#                 assert test["payStatus"] == pro["payStatus"]
#                 assert test["payTime"] == pro["payTime"]
#                 assert test["roomId"] == pro["roomId"]
#                 assert test["roomNumber"] == pro["roomNumber"]
#                 assert test["subjectF"] == pro["subjectF"]
#                 assert test["tenantName"] == pro["tenantName"]
#                 assert test["billNumber"] == pro["billNumber"]
#                 assert test["tableUuid"] == pro["tableUuid"]
#                 assert test["billNumber"] == pro["billNumber"]
#                 assert test["netReceivable"] == pro["netReceivable"]
#     print(f"门店ID：{apartment_id}数据核对完成~!")


# 输出 pairwise 参数组合
if __name__ == '__main__':
    print("PAIRWISE:")
    print("PAIRWISE:1")

    # for i, pairs in enumerate(AllPairs(parameters)):
    #     print("{:2d}: {}".format(i, pairs))

    # driver = webdriver.Chrome()
    # download_room(driver,url=url)
    # time.sleep(10)
    # driver.quit()

    # pytest.main(["-s", "-v","--lf", "/Users/Moon/GIT-Data/Virtualenvs/LefullTestEnv/lefull/test.py"])

